/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mb.webserver.inMemory;

import mb.config.*;
import net.sf.json.JSONObject;
import org.json.simple.JSONValue;
/**
 *
 * @author thanh.nguyenchi
 */
public class BaseProcess {
    int status = 0;
    String error = "";
    
    static String nStatus = "status";
    static String nError = "error";
    static String nServer = "server";
    static String nLang = "lang";
    static String nVersion = "version";
    static String nCache = "cachetime";
    static String nCities = "cities";
    static String nPromotions = "promotions";
    static String nServices = "services";
    static String nNews = "news";
    static String nTotal = "totalCount";
    
    public BaseProcess(){
        
    }
    
    public void process(){
        
    }
    public String toJson(){
        return "";
    }
    
    
    public String errorJson(){
        JSONObject obj = new JSONObject();
        obj.put(nStatus,new Long(status));
        obj.put(nError,this.error);
        return JSONValue.toJSONString(obj);
    }
    
    public String getResult(){
        if (this.status == ConstantsMsg.INT_SUCESSFUL_CODE){
            return toJson();
        }
        else{            
            return errorJson();
        }  
    }
   
}
